Integrand size = 34, antiderivative size = 245 \[ \int \tan ^3(c+d x) (a+i a \tan (c+d x))^n (A+B \tan (c+d x)) \, dx=\frac {2 (i B n-A (3+n)) (a+i a \tan (c+d x))^n}{d n (2+n) (3+n)}+\frac {(A-i B) \operatorname {Hypergeometric2F1}\left (1,n,1+n,\frac {1}{2} (1+i \tan (c+d x))\right ) (a+i a \tan (c+d x))^n}{2 d n}-\frac {(i B n-A (3+n)) \tan ^2(c+d x) (a+i a \tan (c+d x))^n}{d (2+n) (3+n)}+\frac {B \tan ^3(c+d x) (a+i a \tan (c+d x))^n}{d (3+n)}-\frac {\left (A n (3+n)-i B \left (6+3 n+n^2\right )\right ) (a+i a \tan (c+d x))^{1+n}}{a d (1+n) (2+n) (3+n)} \]
[Out]
Time = 0.77 (sec) , antiderivative size = 245, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.147, Rules used = {3678, 3673, 3608, 3562, 70} \[ \int \tan ^3(c+d x) (a+i a \tan (c+d x))^n (A+B \tan (c+d x)) \, dx=\frac {(A-i B) (a+i a \tan (c+d x))^n \operatorname {Hypergeometric2F1}\left (1,n,n+1,\frac {1}{2} (i \tan (c+d x)+1)\right )}{2 d n}-\frac {\left (A n (n+3)-i B \left (n^2+3 n+6\right )\right ) (a+i a \tan (c+d x))^{n+1}}{a d (n+1) (n+2) (n+3)}-\frac {(-A (n+3)+i B n) \tan ^2(c+d x) (a+i a \tan (c+d x))^n}{d (n+2) (n+3)}+\frac {2 (-A (n+3)+i B n) (a+i a \tan (c+d x))^n}{d n (n+2) (n+3)}+\frac {B \tan ^3(c+d x) (a+i a \tan (c+d x))^n}{d (n+3)} \]
[In]
[Out]
Rule 70
Rule 3562
Rule 3608
Rule 3673
Rule 3678
Rubi steps \begin{align*} \text {integral}& = \frac {B \tan ^3(c+d x) (a+i a \tan (c+d x))^n}{d (3+n)}+\frac {\int \tan ^2(c+d x) (a+i a \tan (c+d x))^n (-3 a B-a (i B n-A (3+n)) \tan (c+d x)) \, dx}{a (3+n)} \\ & = -\frac {(i B n-A (3+n)) \tan ^2(c+d x) (a+i a \tan (c+d x))^n}{d (2+n) (3+n)}+\frac {B \tan ^3(c+d x) (a+i a \tan (c+d x))^n}{d (3+n)}+\frac {\int \tan (c+d x) (a+i a \tan (c+d x))^n \left (2 a^2 (i B n-A (3+n))-a^2 \left (i A n (3+n)+B \left (6+3 n+n^2\right )\right ) \tan (c+d x)\right ) \, dx}{a^2 (2+n) (3+n)} \\ & = -\frac {(i B n-A (3+n)) \tan ^2(c+d x) (a+i a \tan (c+d x))^n}{d (2+n) (3+n)}+\frac {B \tan ^3(c+d x) (a+i a \tan (c+d x))^n}{d (3+n)}-\frac {\left (A n (3+n)-i B \left (6+3 n+n^2\right )\right ) (a+i a \tan (c+d x))^{1+n}}{a d (1+n) (2+n) (3+n)}+\frac {\int (a+i a \tan (c+d x))^n \left (a^2 \left (i A n (3+n)+B \left (6+3 n+n^2\right )\right )+2 a^2 (i B n-A (3+n)) \tan (c+d x)\right ) \, dx}{a^2 (2+n) (3+n)} \\ & = \frac {2 (i B n-A (3+n)) (a+i a \tan (c+d x))^n}{d n (2+n) (3+n)}-\frac {(i B n-A (3+n)) \tan ^2(c+d x) (a+i a \tan (c+d x))^n}{d (2+n) (3+n)}+\frac {B \tan ^3(c+d x) (a+i a \tan (c+d x))^n}{d (3+n)}-\frac {\left (A n (3+n)-i B \left (6+3 n+n^2\right )\right ) (a+i a \tan (c+d x))^{1+n}}{a d (1+n) (2+n) (3+n)}-(-i A-B) \int (a+i a \tan (c+d x))^n \, dx \\ & = \frac {2 (i B n-A (3+n)) (a+i a \tan (c+d x))^n}{d n (2+n) (3+n)}-\frac {(i B n-A (3+n)) \tan ^2(c+d x) (a+i a \tan (c+d x))^n}{d (2+n) (3+n)}+\frac {B \tan ^3(c+d x) (a+i a \tan (c+d x))^n}{d (3+n)}-\frac {\left (A n (3+n)-i B \left (6+3 n+n^2\right )\right ) (a+i a \tan (c+d x))^{1+n}}{a d (1+n) (2+n) (3+n)}+\frac {(a (A-i B)) \text {Subst}\left (\int \frac {(a+x)^{-1+n}}{a-x} \, dx,x,i a \tan (c+d x)\right )}{d} \\ & = \frac {2 (i B n-A (3+n)) (a+i a \tan (c+d x))^n}{d n (2+n) (3+n)}+\frac {(A-i B) \operatorname {Hypergeometric2F1}\left (1,n,1+n,\frac {1}{2} (1+i \tan (c+d x))\right ) (a+i a \tan (c+d x))^n}{2 d n}-\frac {(i B n-A (3+n)) \tan ^2(c+d x) (a+i a \tan (c+d x))^n}{d (2+n) (3+n)}+\frac {B \tan ^3(c+d x) (a+i a \tan (c+d x))^n}{d (3+n)}-\frac {\left (A n (3+n)-i B \left (6+3 n+n^2\right )\right ) (a+i a \tan (c+d x))^{1+n}}{a d (1+n) (2+n) (3+n)} \\ \end{align*}
Time = 4.14 (sec) , antiderivative size = 189, normalized size of antiderivative = 0.77 \[ \int \tan ^3(c+d x) (a+i a \tan (c+d x))^n (A+B \tan (c+d x)) \, dx=\frac {(a+i a \tan (c+d x))^n \left (2 i B n \left (8+5 n+n^2\right )-2 A \left (6+8 n+5 n^2+n^3\right )+(A-i B) \left (6+11 n+6 n^2+n^3\right ) \operatorname {Hypergeometric2F1}\left (1,n,1+n,\frac {1}{2} (1+i \tan (c+d x))\right )-2 n \left (i A n (3+n)+B \left (6+3 n+n^2\right )\right ) \tan (c+d x)+2 n (1+n) (-i B n+A (3+n)) \tan ^2(c+d x)+2 B n \left (2+3 n+n^2\right ) \tan ^3(c+d x)\right )}{2 d n (1+n) (2+n) (3+n)} \]
[In]
[Out]
\[\int \left (\tan ^{3}\left (d x +c \right )\right ) \left (a +i a \tan \left (d x +c \right )\right )^{n} \left (A +B \tan \left (d x +c \right )\right )d x\]
[In]
[Out]
\[ \int \tan ^3(c+d x) (a+i a \tan (c+d x))^n (A+B \tan (c+d x)) \, dx=\int { {\left (B \tan \left (d x + c\right ) + A\right )} {\left (i \, a \tan \left (d x + c\right ) + a\right )}^{n} \tan \left (d x + c\right )^{3} \,d x } \]
[In]
[Out]
\[ \int \tan ^3(c+d x) (a+i a \tan (c+d x))^n (A+B \tan (c+d x)) \, dx=\int \left (i a \left (\tan {\left (c + d x \right )} - i\right )\right )^{n} \left (A + B \tan {\left (c + d x \right )}\right ) \tan ^{3}{\left (c + d x \right )}\, dx \]
[In]
[Out]
\[ \int \tan ^3(c+d x) (a+i a \tan (c+d x))^n (A+B \tan (c+d x)) \, dx=\int { {\left (B \tan \left (d x + c\right ) + A\right )} {\left (i \, a \tan \left (d x + c\right ) + a\right )}^{n} \tan \left (d x + c\right )^{3} \,d x } \]
[In]
[Out]
\[ \int \tan ^3(c+d x) (a+i a \tan (c+d x))^n (A+B \tan (c+d x)) \, dx=\int { {\left (B \tan \left (d x + c\right ) + A\right )} {\left (i \, a \tan \left (d x + c\right ) + a\right )}^{n} \tan \left (d x + c\right )^{3} \,d x } \]
[In]
[Out]
Timed out. \[ \int \tan ^3(c+d x) (a+i a \tan (c+d x))^n (A+B \tan (c+d x)) \, dx=\int {\mathrm {tan}\left (c+d\,x\right )}^3\,\left (A+B\,\mathrm {tan}\left (c+d\,x\right )\right )\,{\left (a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}\right )}^n \,d x \]
[In]
[Out]